<%--
  Created by IntelliJ IDEA.
  User: 走过全世界。
  Date: 2017/5/26 0026
  Time: 10:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
    <title>借书管理</title>
    <link href="css/styles.css" rel="stylesheet" type="text/css"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<h1>Hello Page</h1>
<c:if test="${sessionScope.user != null}">
    <h3>
        欢迎你，${sessionScope.user.username}
    </h3>
    <div>
        <table class="bordered">
            <thead>
            <tr>
                <th>编号</th>
                <th>书名</th>
                <th>索书号</th>
                <th>借书人</th>
                <th>借书日期</th>
                <th>归还日期</th>
            </tr>
            </thead>
            <c:choose>
                <c:when test="${requestScope.borrowedBooks != null}">
                    <c:forEach items="${requestScope.borrowedBooks}" var="borrowedbook" varStatus="id">
                        <thead>
                        <tr>
                            <th>${id.index + 1}</th>
                            <th>${borrowedbook.book_name}</th>
                            <th>${borrowedbook.call_number}</th>
                            <th>${borrowedbook.username}</th>
                            <th>
                                <fmt:formatDate value="${borrowedbook.borrow_time}" type="date"
                                                dateStyle="default"></fmt:formatDate>
                            </th>
                            <th><fmt:formatDate value="${borrowedbook.return_time}" type="date"
                                                dateStyle="default"></fmt:formatDate>
                            </th>
                        </tr>
                        </thead>
                    </c:forEach>
                </c:when>
                <c:when test="${requestScope.borrowedBooks == null}">
                </c:when>
            </c:choose>
        </table>
    </div>
</c:if>
<br/><br>
<br/><br>
<a href="/sql">返回首页</a>
</body>
</html>
